package cn.hacynn.nd.mapper;

import cn.hacynn.nd.pojo.entity.Share;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Select;

import java.util.List;

/**
 * @Author Hacynn
 * @Date 2024/5/28 22:36
 * @Version 1.0
 */
@Mapper
public interface ShareMapper extends BaseMapper<Share> {

    /**
     * 根据文件路径查找分享的文件列表
     * @param userId
     * @param ossPath
     * @return
     */
    @Select("select * from share where user_id = #{userId} and file_path = #{ossPath} and status != #{status}")
    List<Share> getSharingFilesByPath(Long userId, String ossPath, int status);
}
